"""
Author: HuWen
@file: page_enterprise_management_info.py
@dateTime: 2025/7/7 14:27
加油加油！！！
"""
from playwright.sync_api import Page
from common.base_page import BasePage
from common.logger import logger
from locators.basicSecurityInformation.loc_enterprise_operation_info import EnterpriseOperationInformation


class EnterpriseManagementInfoPage(BasePage):

    def __init__(self, page: Page):
        super().__init__(page)
        self.switch_menu('安全基础管理')
        # self.switch_menu('企业安全基础信息管理')
        # self.switch_menu('企业档案')
        # self.click(EnterpriseOperationInformation.loc_enterprise_management_info_tab)

    def edit_enterprise_info(self, business_scope, products, raw_materials, area):
        # 点击企业经营信息标签
        self.click(EnterpriseOperationInformation.loc_enterprise_management_info_tab)
        # 点击编辑按钮
        self.click(EnterpriseOperationInformation.loc_edit_button)
        # 输入主要经营范围
        self.fill(EnterpriseOperationInformation.loc_main_business_scope, business_scope)
        # 输入主要产品
        self.fill(EnterpriseOperationInformation.loc_main_products, products)
        # 输入主要原料
        self.fill(EnterpriseOperationInformation.loc_main_raw_materials, raw_materials)
        # 输入生产经营单位面积 ,先强制清空下
        self.clear_by_backspace(EnterpriseOperationInformation.loc_production_area)
        self.fill_number(EnterpriseOperationInformation.loc_production_area, area)
        # 提交
        self.click(EnterpriseOperationInformation.loc_sub)